﻿
var el_exp;
var menu_lv1_height = 30; 
var margin_height = 0;  

var frameTop = parent.parent.window.document.getElementById("centerFrame");
var frameTopWindow;
if (frameTop.window == undefined) {
    //FF
    frameTopWindow = frameTop.contentWindow;
}
else {
    //IE
    frameTopWindow = frameTop.window;
}



function doMenu(id,url) {

    var el = document.getElementById(id);
    if (el_exp != el) {
        if (el_exp)
            el_exp.style.display = "none";
        el_exp = el;
//        autoSize(el_exp);
        if (el_exp.style.display != "block")
            el_exp.style.display = "block";
    }
    if (url != null) showNav("true", url);
}

function autoSize(el) {
   

    el = typeof (el) == "object" ? el : document.getElementById(el);
   
    var menus = document.getElementById("menu").getElementsByTagName("ul");
    var h;
//    if(menus.length==1)
//    {
//         h = window.document.documentElement.clientHeight - menus.length * menu_lv1_height;
//    }
//    else if(menus.length==2)
//    {
//         h = window.document.documentElement.clientHeight - menus.length * menu_lv1_height + 5;
//    }
//    else
//    {
         h = window.document.documentElement.clientHeight - menus.length * menu_lv1_height + (menus.length-1) * 5;
//    }
    if (el != undefined) {
        el.style.height = h + "px";
        el.style.overflowX = "hidden";
        el.style.overflowY = "auto";
    }
}



function showNav(isShow, url) {
    var main = parent.window.document.getElementById("centerFrameset");
    if ("true" == isShow && main != null) {
        frameTopWindow.document.IsClosed = false;
        main.cols = "195,7,*";
    }
    else if (main != null) {
        frameTopWindow.document.IsClosed = true;
        main.cols = "0,0,*";
    }
    if (url != "" && main != null) frameTopWindow.frames[2].location = url;
}
